<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Strict//EN' 'http://www.w3.org/TR/html4/strict.dtd'>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
<title>在此插入标题</title>
<link rel="stylesheet" href="../layui/layui/css/layui.css" media="all">
<script src="../layui/layui/layui.js"></script>

</head>
<body>
	<form class="layui-form" action="公司信息.html">
		<div class="layui-form-item">
			<label class="layui-form-label">公司名称</label>
			<div class="layui-input-block">
				<input type="text" name="name" placeholder="请输入公司名称"
					autocomplete="off" class="layui-input" id="name">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">电话</label>
			<div class="layui-input-block">
				<input type="text" name="phone" placeholder="请输入电话"
					autocomplete="off" class="layui-input" id="phone">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">介绍</label>
			<div class="layui-input-block">
				<input type="text" name="jieshao" placeholder="请输入介绍"
					autocomplete="off" class="layui-input" id="jieshao">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">电子邮件</label>
			<div class="layui-input-block">
				<input type="text" name="email" placeholder="请输入电子邮件"
					autocomplete="off" class="layui-input" id ="email">
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="sub">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>

		</div>
	</form>
	
	
	<script src="../layui/layui/layui.js"></script>

	<script src="../js/jquery-1.8.2.js"></script>
	
	
	
	<script type="text/javascript">
		function getQueryString(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			var url = decodeURI(decodeURI(window.location.search))
			var r = url.substr(1).match(reg);
			if (r != null)
				return unescape(r[2]);
			return null;
		}
		$(document).ready(function() {
			var id = getQueryString("id");
			var name = getQueryString("name");
			var phone = getQueryString("phone");
			var jieshao = getQueryString("jieshao");
			var email = getQueryString("email");
			
			
			//方法一 :query赋值
			
			$("#name").val(name);
			$("#phone ").val(phone );
			$("#jieshao").val(jieshao);
			$("#email").val(email);
			
		});
	</script>
	
	<script>
		//JavaScript代码区域
		
		/**$(function(){
		
			$.ajax({
				url : "",
				type : "get",
				data : {},
				success : function(res) {
					var $select = $("#type");//下拉菜单
					for (var i = 0; i < res.data.length; i++) {
						$select.append("<option value='"+res.data[i].id+"'>"
								+ res.data[i].zl + "</option>");
					}
				},
			});
		});
		*/
		
		layui.use([ 'form', 'table','element','layer' ], function() {
			var form = layui.form;
			var table = layui.table;
			var layer = layui.layer;
			var element=layui.element;
			var $ = layui.$;

			//submit提交事件
			form.on('submit(sub)', function(data) {
				console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
				var id = getQueryString("id");
				data.field.id = id;
				
				$.ajax({
					url : '../gsxxxg',
					type : "get",
					data : data.field,
					success : function(qwe) {

						layer.msg(qwe.msg);

					},

				});

				//return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
			});

		})
	</script>

</body>
</html>